package com.adam.springmvc.generator.mapper;

import com.adam.springmvc.generator.model.Student;
import com.adam.springmvc.generator.model.StudentExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface StudentMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    long countByExample(StudentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int deleteByExample(StudentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Delete({
        "delete from students",
        "where stud_id = #{studId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer studId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Insert({
        "insert into students (stud_id, name, ",
        "email, dob)",
        "values (#{studId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, ",
        "#{email,jdbcType=VARCHAR}, #{dob,jdbcType=DATE})"
    })
    int insert(Student row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int insertSelective(Student row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    List<Student> selectByExample(StudentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Select({
        "select",
        "stud_id, name, email, dob",
        "from students",
        "where stud_id = #{studId,jdbcType=INTEGER}"
    })
    @ResultMap("com.adam.springmvc.generator.mapper.StudentMapper.BaseResultMap")
    Student selectByPrimaryKey(Integer studId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByExampleSelective(@Param("row") Student row, @Param("example") StudentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByExample(@Param("row") Student row, @Param("example") StudentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByPrimaryKeySelective(Student row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table students
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Update({
        "update students",
        "set name = #{name,jdbcType=VARCHAR},",
          "email = #{email,jdbcType=VARCHAR},",
          "dob = #{dob,jdbcType=DATE}",
        "where stud_id = #{studId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Student row);
}